package org.activiti.solon.constants;

/**
 * 审核行为定义
 */
public enum DecisionEnum {
    REJECT(0, "拒绝"),
    PASS(2, "同意"),
    CLAIM(4, "认领"),
    SUBMIT(6, "提交"),
    DONE(8, "结束"),
    REVOKE(10, "撤销"),
    TRAN(12, "转办");
    
    private final int code;
    private final String desc;

    DecisionEnum(int value, String desc) {
        this.code = value;
        this.desc = desc;
    }

    public int code() {
        return this.code;
    }

    public String desc() {
        return this.desc;
    }

    public static DecisionEnum get(int code) {
        for (DecisionEnum item : values()) {
            if (item.code() == code) {
                return item;
            }
        }
        return null;
    }

    public static String getDescByCode(int code) {
        for (DecisionEnum item : values()) {
            if (item.code() == code) {
                return item.desc();
            }
        }
        return "";
    }
}
